import request from '@/utils/request'

// 创建项目任务
export function createTask(data) {
  return request({
    url: '/system/task/create',
    method: 'post',
    data: data
  })
}
//
export function listTaskTypes(){
  return request({
    url: '/system/task/types',
    method: 'get'
  })
}
//
export function taskTypesMap(){
  return request({
    url: '/system/task/typesMap',
    method: 'get'
  })
}
//
export function listTaskStatus(){
  return request({
    url: '/system/task/status',
    method: 'get'
  })
}
export function taskStatusMap(){
  return request({
    url: '/system/task/statusMap',
    method: 'get'
  })
}
export function listProcessTypes(){
  return request({
    url: '/system/task/processTypes',
    method: 'get'
  })
}
export function processTypesMap(){
  return request({
    url: '/system/task/processTypesMap',
    method: 'get'
  })
}

export function listLeaders(){
  return request({
    url: '/system/task/leaders',
    method: 'get'
  })
}
export function listMembers(query){
  return request({
    url: '/system/task/members',
    method: 'get',
    params: query
  })
}
// 查询项目列表 用于下拉框选择
export function listProject(query) {
  return request({
    url: '/system/project/list/my',
    method: 'get',
    params: query
  })
}
//查询所有项目任务列表
export function listTask(query) {
  return request({
    url: '/system/task/list',
    method: 'get',
    params: query
  })
}

//获取任务详情
export function getTask(taskId) {
  return request({
    url: '/system/task/' + taskId,
    method: 'get'
  })
}

//项目经理查询任务列表
export function listManagerTask(query) {
  return request({
    url: '/system/task/list/manager',
    method: 'get',
    params: query
  })
}
//项目主管查询任务列表
export function listDirectorTask(query) {
  return request({
    url: '/system/task/list/director',
    method: 'get',
    params: query
  })
}
//小组长查询任务列表
export function listLeaderTask(query) {
  return request({
    url: '/system/task/list/leader',
    method: 'get',
    params: query
  })
}
//待评分任务列表
export function listEvaluatorTask(query) {
  return request({
    url: '/system/task/list/evaluator',
    method: 'get',
    params: query
  })
}

// 删除项目
export function delTask(taskId) {
  return request({
    url: '/system/task/remove?taskId=' + taskId,
    method: 'delete'
  })
}
// 修改任务信息
export function updateTask(taskInfo) {

  return request({
    url: '/system/task/modify',
    method: 'put',
    params: taskInfo
  })
}
//主管转发任务到小组
export function forwardTask(data) {
  return request({
    url: '/system/task/forward',
    method: 'post',
    data: data
  })
}
//小组长分配任务工作到成员
export function assignTask(data) {
  return request({
    url: '/system/task/assign',
    method: 'post',
    data: data
  })
}
//项目经理评价项目任务
export function evaluateTask(data) {
  return request({
    url: '/system/task/evaluate',
    method: 'post',
    data: data
  })
}

export function attachment(data){
  return request({
    url: '/system/task/attachment',
    method: 'post',
    data: data
  })
}

export function deattachment(filePath) {
  return request({
    url: '/system/task/deattachment?filePath=' + encodeURI(filePath),
    method: 'delete'
  })
}